package teamGiga.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sun.xml.internal.ws.api.ha.StickyFeature;

import teamGiga.bean.ShoppingBean;
import teamGiga.dao.CartDao;
import action.servlet.ActionForWard;

public class ShoppingAction extends Action{
	private String path;
	private boolean redirect;
	
	
	public ShoppingAction() {
		super();
	}


	public ShoppingAction(String path, boolean redirect) {
		super();
		this.path = path;
		this.redirect = redirect;
	}


	@Override
	public ActionForWard execute(HttpServletRequest request,
			HttpServletResponse response) {
		// TODO Auto-generated method stub
		
		String mbno =request.getParameter("mbno");		
		String mname = request.getParameter("mname");
		String pay = request.getParameter("price");
		String mbname=request.getParameter("mbname");		
		String fileimg = request.getParameter("fileimg");
		String mno=request.getParameter("mno");
	//System.out.println("mbno"+mbno+"mname"+mname+"pay"+pay+"mbname"+mbname+"fileimg"+fileimg+"mno"+mno);		
		
	ShoppingBean bean=new ShoppingBean(Integer.parseInt(mbno),Integer.parseInt(mno),mname,Integer.parseInt(pay),mbname,fileimg);
    

		try {			
			
		      CartDao.insertCart(bean);
			
			
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		//ShoppingBean bean = new ShoppingBean();
		
		
		return new ActionForWard(path, redirect);
	}
	
	
	
	
}
